package com.dai.spec.gxk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dai.spec.common.utils.StringUtils;
import com.dai.spec.gxk.domain.Course;
import com.dai.spec.gxk.mapper.CourseMapper;
import com.dai.spec.gxk.service.CourseService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程信息管理Service业务层处理
 *
 * @author daikl
 * @date 2024-02-29
 */
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService {
    /**
     * 查询课程信息管理列表
     *
     * @param course 课程信息管理
     * @return 课程信息管理集合
     */
    @Override
    public List<Course> queryList(Course course) {
        LambdaQueryWrapper<Course> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(course.getCourseName())) {
            queryWrapper.like(Course::getCourseName, course.getCourseName());
        }
        if (StringUtils.isNotEmpty(course.getDepartment())) {
            queryWrapper.eq(Course::getDepartment, course.getDepartment());
        }
        if (StringUtils.isNotEmpty(course.getCourseCycle())) {
            queryWrapper.eq(Course::getCourseCycle, course.getCourseCycle());
        }
        if (StringUtils.isNotEmpty(course.getType())) {
            queryWrapper.eq(Course::getType, course.getType());
        }
        if (StringUtils.isNotEmpty(course.getDeliveryType())){
            queryWrapper.eq(Course::getDeliveryType,course.getDeliveryType());
        }

        return this.list(queryWrapper);
    }

}
